-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: add documentation for AtExit hook #1014
Conversation
|
||
Registers exit hooks that run after the event loop has ended, but before the VM is killed. | ||
|
||
Callbacks are run in reverse order of registration, i.e. newest first. AtExit takes callback and its arguments as arguments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The explanation here seems confusing, suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Callbacks are run in last-in, first-out order. AtExit
takes two parameters: a pointer to a callback function to run at exit, and a pointer to untyped context data to be passed to that callback."
I'm generally +1 on this – we might see if it breaks the addons tests (which generate tests from code snippets in the addons.markdown doc.) |
} | ||
|
||
void init(Handle<Object> exports) { | ||
AtExit(at_exit_cb1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe AtExit(at_exit_cb1, exports->GetIsolate()
and then static_cast<v8::Isolate*>(arg)
in the callback? v8::Isolate::GetCurrent()
is going away someday so I'd prefer not to encourage its use in the documentation.
(That said, I realize it's used in plenty of other places in this document. I'll file a PR to clean that up.)
Ping @JCMais, are you able to update? |
Updates addons.markdown to mention AtExit() function. Addresses issue #8324.
Updated description, added arguments and arguments types, and quick code example.
Incorporated latest suggestions.
@Fishrock123 Sorry, totally forgot about this pull request. Updated. |
ping @bnoordhuis for review? |
Fixes: #999 PR-URL: #1014 Reviewed-By: Ben Noordhuis <[email protected]>
Landed in 98649fd with some fixes to make |
Fixes: nodejs/node#999 PR-URL: nodejs/node#1014 Reviewed-By: Ben Noordhuis <[email protected]>
See #999.